package com.fz.day2;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class AppCore {
    public static void main(String[] args) throws  Exception {
        Class<?> C = Class.forName("com.fz.day2.CoreService");
        Object o = C.newInstance();
        Field[] fields = C.getDeclaredFields();
        for(Field field : fields) {
            field.setAccessible(true);
            Class<?> type = field.getType();
            Object u = type.newInstance();
            field.set(o, u);
        }
        Method say = C.getMethod("say");
        say.invoke(o);
    }
}
